#ifndef LED_H
#define LED_H

#include <stm32f4xx.h>

// LED引脚
#define LED_P2 GPIO_Pin_6
#define LED_P3 GPIO_Pin_7
// GPIO
#define LED_GPIO GPIOA                                                                 // GPIOA组
#define LED_GPIO_Pin (LED_P2 | LED_P3)                                                 // LED引脚
#define LED_RCC_AHBPeriphClockCmd RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE) // 时钟使能

/**
 * @name LED
 * @enum
 */
typedef enum tag_LED {
    LED_D2 = LED_P2, // LED2灯
    LED_D3 = LED_P3, // LED3灯
} LED;

/**
 * @name LED状态
 * @enum
 */
typedef enum tag_LED_STATE {
    LED_OFF = 0, // LED灭
    LED_ON = 1   // LED亮
} LED_STATE;

/**
 * @name led初始化
 * @description
 * @function
 * @returns {void}
 * @requires []
 */
void led_init(void);

/**
 * @name led控制
 * @description
 * @function
 * @param {LED} led LED
 * @param {LED_STATE} state LED状态
 * @returns {void}
 * @requires [led,state]
 */
void led_control(const LED led, const LED_STATE state);

/**
 * @name led状态
 * @description
 * @function
 * @param {LED} led LED
 * @returns {LED_STATE} LED状态
 * @requires [led]
 */
LED_STATE led_state(const LED led);

#endif
